package com.le.tester.sevice.impl;

import com.le.tester.dao.EmployeeDao;
import com.le.tester.dao1.EmployeeSalaryDao;
import com.le.tester.dto.EmployeeDto;
import com.le.tester.sevice.EmployeeService;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import javax.annotation.Resource;

/**
 * createTime：2022/1/12 17:04
 * description：获取OGPost信息实现
 */
@Service
public class EmployeeServiceImpl implements EmployeeService {


    @Resource
    public EmployeeDao employeeDao;

    @Resource
    public EmployeeSalaryDao employeeSalaryDao;

    @EventListener
    @Transactional(rollbackFor = Exception.class)
    public String join(EmployeeDto employeeDto) {

        employeeDao.addEmployee(employeeDto);

        employeeSalaryDao.addEmployeeSalary(employeeDto.getId(), employeeDto.getSalary());

        //int i = 1 / 0;

        return "新增成功";

    }

}
